<html>
<head><meta charset="utf-8"><title>cargo-miri--start-fn · t-compiler/const-eval · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/index.html">t-compiler/const-eval</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html">cargo-miri--start-fn</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="136092642"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136092642" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136092642">(Oct 19 2018 at 06:31)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@Oli</span> <span class="user-mention" data-user-id="132769">@Andrew Poelstra</span> I am wondering if we can remove the footgun of forgetting to pass <code>-- -Zmiri-start-fn</code> to <code>cargo miri</code>, which leads to memory leaks errors because TLS wasn't initialized (and maybe there are other errors?). I see several options, but I am not sure which one I like most:</p>
<ul>
<li>Kill <code>-Zmiri-start-fn</code> and instead auto-detect if we have a libstd with all the MIR (looking up some monomorphic function and seeing if it got MIR). That would be most convenient and it matches the state we used to have before the <code>start_fn</code> lang item got polymorphic.</li>
<li>Always pass <code>-Zmiri-start-fn</code> from <code>cargo miri</code>. Forces people to get a libstd with full MIR, even if their code doesn't otherwise need it.</li>
<li>Disable the leak check unless <code>-Zmiri-start-fn</code> is passed. Seems like a shame though, we have an entire test suite showing that the leak check works just fine there.</li>
</ul>



<a name="136092701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136092701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136092701">(Oct 19 2018 at 06:33)</a>:</h4>
<p>My tendency is with the first option, I have to say. Fewer flags always seem nice^^</p>



<a name="136094366"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136094366" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136094366">(Oct 19 2018 at 07:17)</a>:</h4>
<p>first option sounds good. I nominate <code>rust_panic</code> as the canary</p>



<a name="136096737"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136096737" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136096737">(Oct 19 2018 at 08:17)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@Oli</span> <a href="https://github.com/solson/miri/pull/488" target="_blank" title="https://github.com/solson/miri/pull/488">https://github.com/solson/miri/pull/488</a></p>



<a name="136096878"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136096878" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136096878">(Oct 19 2018 at 08:20)</a>:</h4>
<p>\o/</p>



<a name="136097064"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136097064" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136097064">(Oct 19 2018 at 08:24)</a>:</h4>
<p>that was fast :P</p>



<a name="136097076"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136097076" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136097076">(Oct 19 2018 at 08:25)</a>:</h4>
<p>On a related note... <span class="user-mention" data-user-id="132769">@Andrew Poelstra</span> so what do we do about <a href="https://github.com/solson/miri/pull/483" target="_blank" title="https://github.com/solson/miri/pull/483">https://github.com/solson/miri/pull/483</a> ? Do you still think we should tell the user to copy stuff around? I think we shouldn't. We should rather tell them to do <code>cargo clean</code>, and then <code>MIRI_SYSROOT=~/.xargo/HOST cargo miri</code>, and that should work without any copy.</p>



<a name="136097086"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136097086" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136097086">(Oct 19 2018 at 08:25)</a>:</h4>
<p><span class="user-mention" data-user-id="132916">@Christian Poveda</span> welcome to Zulip :D</p>



<a name="136097102"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136097102" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Christian Poveda <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136097102">(Oct 19 2018 at 08:25)</a>:</h4>
<p>ty :)</p>



<a name="136102696"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136102696" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136102696">(Oct 19 2018 at 10:29)</a>:</h4>
<p><span class="user-mention" data-user-id="124288">@Oli</span> your two suggestions would become separate commits, so I am going to make them one commit manually instead</p>



<a name="136102702"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136102702" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136102702">(Oct 19 2018 at 10:29)</a>:</h4>
<p>yea, the feature is cool, but not quite ready yet</p>



<a name="136105747"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136105747" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136105747">(Oct 19 2018 at 11:40)</a>:</h4>
<p><em>lol</em> when you work on rustc+miri and const validation tells you your miri sources contain a bad const^^</p>



<a name="136107698"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136107698" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Poelstra <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136107698">(Oct 19 2018 at 12:26)</a>:</h4>
<p>@RalfJ agreed, I should change the PR to recommend <code>cargo clean</code> rather than copying stuff around. That's much simpler</p>



<a name="136108324"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136108324" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136108324">(Oct 19 2018 at 12:40)</a>:</h4>
<p><span class="user-mention" data-user-id="132769">@Andrew Poelstra</span> also with <code>-Zmiri-start-fn</code> gone thinks are hopefully a bit better now</p>



<a name="136108358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136108358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136108358">(Oct 19 2018 at 12:41)</a>:</h4>
<p>I think the biggest footgun left is not using the same toolchain for <code>xargo/build.sh</code> and <code>cargo miri</code>. Should probably be mentioned: "If you get strange errors, try <code>cargo clean</code> and make sure you used the same toolchain for ..."</p>



<a name="136108367"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136108367" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Poelstra <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136108367">(Oct 19 2018 at 12:41)</a>:</h4>
<p>I actually don't know what <code>-Zmiri-start-fn</code> does. I haven't able to build something without a MIR-enabled std to run <code>cargo miri</code> on it</p>



<a name="136108427"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136108427" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Poelstra <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136108427">(Oct 19 2018 at 12:42)</a>:</h4>
<p>Agreed -- even now sometimes I forget to set MIRI_SYSROOT and things break with "cannot find std". Now I know the correct response is <code>cargo clean</code> and then set MIRI_SYSROOT, but at first this was extremely confusing</p>



<a name="136108440"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136108440" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Andrew Poelstra <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136108440">(Oct 19 2018 at 12:43)</a>:</h4>
<p>so I'll update the README PR to say that</p>



<a name="136108507"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn/near/136108507" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> RalfJ <a href="https://rust-lang.github.io/zulip_archive/stream/146212-t-compiler/const-eval/topic/cargo-miri--start-fn.html#136108507">(Oct 19 2018 at 12:44)</a>:</h4>
<p>thanks :)</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>